/**
 * 2
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-9-19 下午6:53
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> nums(n);

    for (int i = 0; i < n; i++) {
        cin >> nums[i];
    }

    int result = n;
    sort(nums.begin(), nums.end());

    for (int i = 0; i <= n - m; i++) {
        if (nums[i + m - 1] - nums[i] <= k) {
            result--;
        }
    }

    cout << result << endl;

    return 0;
}
